Skip to content

Added test project and moved to Microsoft.CodeAnalysis v1.0.0#67

Merged
JoshVarty merged 7 commits intomasterfrom
AddingTests
Jan 5, 2015
Merged

Added test project and moved to Microsoft.CodeAnalysis v1.0.0#67
JoshVarty merged 7 commits intomasterfrom
AddingTests

Conversation

@JoshVarty
Copy link
Contributor

This will fix #11 and from now on we should be adding tests when fixing generator bugs such as #17 and #64.

I've used Kirill Osenkov's MSBuildWorkspaceTestBase class. You can see how they're using it internally here: http://source.roslyn.codeplex.com/#Roslyn.Services.UnitTests/WorkspaceTests/MSBuildWorkspaceTests.cs,148

It seems like a nice approach to quickly and easily create solutions without having to write a ton of boilerplate code.

This new version of Microsoft.CodeAnalysis depends on MEF 2 which is the Microsoft.Composition package on NuGet.

I still have to write tests for parameters and locals and will do so after #66 is merged.

We need to do this in order to use Roslyn's test framework.
We also needed to add a reference to MEF 2 (Microsoft.Composition) which
isn't yet distributed via .NET.
We don't need to be signing these things as we're not working with
anyone else's internals.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var walker = SourceBrowser.Generator.DocumentWalkers.WalkerSelector.GetWalker(fm, document, linkProvider);

Also, make SourceBrowser.Generator.DocumentWalkers.WalkerSelector a public class
Apply this change to other tests

@AmadeusW
Copy link
Member

AmadeusW commented Jan 4, 2015

MSBuildWorkspaceTestClass looks really handy. Good job! 😄

I tried integrating this with Marcin's PR #70 but the checked out pull request branches are read only (which means that only he can adapt his code to this merge). Is it ok if we merge #70 first? Then we need to do the following:

  1. make WalkerSelector a public class
  2. use WalkerSelector throughout the test cases
  3. use the tests to verify that the CSWalker works

@MarcinJuraszek
Copy link
Contributor

You can add InternalsVisibleTo to the generator and make internal members visible from UnitTests project instead of making WalkerSelector public.

@JoshVarty
Copy link
Contributor Author

Yeah, we'll just use InternalsVisibleTo and make WalkerSelector internal instead of private.

@JoshVarty JoshVarty merged commit d8d4b87 into master Jan 5, 2015
@JoshVarty JoshVarty deleted the AddingTests branch January 16, 2015 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests.

3 participants